package com.luomuchen.demo02;


import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import tk.mybatis.spring.annotation.MapperScan;

@SpringBootApplication
@MapperScan("com.luomuchen.demo02.mapper")
public class Demo02Application {
    @Bean
    public Redisson redisson(){
        Config config = new Config();
        config.useClusterServers().setScanInterval(2000)//集群扫描间隔，单位是毫秒
                .addNodeAddress("redis://hadoop100:6379")
                .addNodeAddress("redis://hadoop100:6380")
                .addNodeAddress("redis://hadoop100:6381")
                .addNodeAddress("redis://hadoop100:6389")
                .addNodeAddress("redis://hadoop100:6390")
                .addNodeAddress("redis://hadoop100:6391");
        return (Redisson) Redisson.create(config);
    }
    public static void main(String[] args) {
        SpringApplication.run(Demo02Application.class, args);
    }

}
